package com.emser.unc.server.servlets;

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.emser.unc.server.LoginHelper;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;

public class LogoutGoogleServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
		UserService userService = UserServiceFactory.getUserService();
		request.getSession().invalidate();
		String googleLogoutUrl = userService.createLogoutURL(LoginHelper.getApplitionURL(request));
    	response.sendRedirect(googleLogoutUrl);
	}

}
